package com.jason.lightreader.aop;

import com.jason.lightreader.exception.ServiceException;
import com.jason.lightreader.response.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ServiceExceptionAdvice {
    @ExceptionHandler(ServiceException.class)
    public Result ServiceExceptionHandling(ServiceException e){
        e.printStackTrace();
        return Result.get(e.getCode(),e.getMessage());
    }
}
